#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
	int days;
	scanf("%d", &days);
	while (days != 0) {
		int i = 0;
		int sum = 0;
		while (sum <= days) {
			++i;
			sum += i;
		}
		sum -= i;

		int goldCoins = 0;
		for (int j = 1; j < i; j++) {
			goldCoins += (j * j);
		}
		
		if (sum < days) {
			goldCoins += ((days - sum) * i);
		}
		printf("%d %d\n", days, goldCoins);
		scanf("%d", &days);

	}
	return 0;
}